//
//  BaseMacro.swift
//  BMort_SwiftUI
//
//  Created by anscen on 2022/9/1.
//

import UIKit
import Hue
@_exported import SwiftUI

let moya = BMoya()
let SCREEN_WIDTH  :CGFloat  = UIScreen.main.bounds.size.width
let SCREEN_HEIGHT :CGFloat  = UIScreen.main.bounds.size.height
public enum BAppMortState :String{
    case gjjMort     = "10000"
    case syMort      = "10001"
    case group       = "10002"
}
extension Color{
    static func appColor() ->Color{
        return Color(UIColor(hex: "3991F0"))
    }
    static func appx000000() ->Color{
        let color = UIColor { (trainCollection) -> UIColor in
            return UIColor(hex: trainCollection.userInterfaceStyle == .dark ? "999999" : "000000")
        }
        return Color(color)
    }
    static func appx333333() ->Color{
        let color = UIColor { (trainCollection) -> UIColor in
            return UIColor(hex: trainCollection.userInterfaceStyle == .dark ? "888888" : "333333")
        }
        return Color(color)
    }
    static func appx666666() ->Color{
        let color = UIColor { (trainCollection) -> UIColor in
            return UIColor(hex: trainCollection.userInterfaceStyle == .dark ? "777777" : "666666")
        }
        return Color(color)
    }
    static func appx999999() ->Color{
        let color = UIColor { (trainCollection) -> UIColor in
            return UIColor(hex: trainCollection.userInterfaceStyle == .dark ? "666666" : "999999")
        }
        return Color(color)
    }
    static func appxffffff() ->Color{
        let color = UIColor { (trainCollection) -> UIColor in
            return UIColor(hex: trainCollection.userInterfaceStyle == .dark ? "000000" : "ffffff")
        }
        return Color(color)
    }
    static func appxdddddd() ->Color{
        let color = UIColor { (trainCollection) -> UIColor in
            return UIColor(hex: trainCollection.userInterfaceStyle == .dark ? "000000" : "dddddd")
        }
        return Color(color)
    }
}
extension UIImage{
    public static func imageWithColor(color:UIColor) -> UIImage{
        let rect = CGRect(x: 0, y: 0, width: 1, height: 1)
        UIGraphicsBeginImageContext(rect.size)
        guard let context = UIGraphicsGetCurrentContext() else { return UIImage() }
        context.setFillColor(color.cgColor)
        context.fill(rect)
        let image = UIGraphicsGetImageFromCurrentImageContext()
        UIGraphicsEndImageContext()
        return image ?? UIImage()
     }
}
